

var api = require('../../utils/api.js');
var app = getApp();


Page({

    /**
     * 页面的初始数据
     */
    data: {
        wind:0,
        text:'',
        lists:[],
        selectedDate:''
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad(options) {
        var that=this;
        var city=wx.getStorageSync('address')
        var selectedDate=options.selectedDate;

        this.setData({
            selectedDate:selectedDate
        })

        api.post({
            url: 'hospital/getcityworker',
            data: {citys:city,selectedDate:selectedDate},
            success: data => {
                console.log(data);

                that.setData({
                    lists:data.data
                })

            }

        })
    },

    selectmes(ret){
        var wid=this.data.wid;
        var wname=this.data.wname;

        wx.setStorageSync('wid', wid)
        wx.setStorageSync('wname', wname)

        var pages = getCurrentPages();
        var prevPage = pages[pages.length - 2]; // 获取父页面实例对象

        prevPage.setData({
            wname: wname,
            wid:wid
        });
        wx.navigateBack();
    },
    selectme(ret){
      
        var index=ret.currentTarget.dataset.i;
        var list=this.data.lists;

        var wid=list[index].id;
        var wname=list[index].name;
        var text=list[index].hsp;

        this.setData({
            text:text,
            wid:wid,
            wname:wname,
            wind:1
        })
    },
    hidewind(){
        this.setData({
            wind:0
        })
    }

})